<!DOCTYPE html>
<html>
    
    <head>
       <meta charset="UTF-8">
        {include="style"}
		<link rel="stylesheet" type="text/css" href="{__Tpl_style__}/style/tags/jquery.tagsinput.css" />
		<script type="text/javascript" charset="utf-8" src="{__Tpl_style__}/style/tags/jquery.tagsinput.js"></script>
		{include="edit"}
		
    </head>
    
    <body>
	 <div class="x-nav">
            <span class="layui-breadcrumb">
              <a><cite>首页</cite></a>
              <a><cite>扩展模型管理</cite></a>
              <a><cite>修改{$molds['name']}</cite></a>
            </span>
            <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right"  href="javascript:location.replace(location.href);" title="刷新"><i class="iconfont" style="line-height:30px">&#xe6aa;</i></a>
        </div>
        <div class="x-body">
            <form class="layui-form layui-form-pane" >
			<input type="hidden" name="go" value="1" />
			<input type="hidden" name="id" value="{$data['id']}" />
			
			<div class="layui-tab">
			  <ul class="layui-tab-title">
				<li class="layui-this">基本信息</li>
				
			  </ul>
			  <div class="layui-tab-content">
				<div class="layui-tab-item layui-show">
				{if($molds['isclasstype']==1)}
				<div class="layui-form-item">
                    <label for="tid" class="layui-form-label">
                        <span class="x-red">*</span>所属栏目
                    </label>
                    <div class="layui-input-inline">
						<select name="tid" lay-search="" lay-filter="tid" {if($molds['ismust']==1)}lay-verify="required"{/if} id="tid" >
						{if($molds['ismust']==1)}
						<option value="">选择栏目</option>
						{else}
						<option value="0">不限栏目</option>
						{/if}
					   {foreach $classtypes as $v}
					   {if($v['molds']==$molds['biaoshi'])}
					   {if($admin['classcontrol']==0 || $admin['isadmin']==1 || strpos($tids,','.$v['id'].',')!==false || $molds['iscontrol']==0)}
					   <option {if($data['tid']==$v['id'])} selected="selected" {/if}  value="{$v['id']}">{fun str_repeat('--', $v['level'])}{$v['classname']}</option>
					   {/if}
					   {/if}
					   {/foreach}
					  
					   </select>
                    </div>
                </div>
				{else}
				<input type="hidden" name="tid" value="{$data['tid']}" />
				{/if}
				<span id="ext_fields"></span>
				
				
				<div class="layui-form-item layui-form-text">
                    <label for="tags" class="layui-form-label">
                        <span class="x-red"></span>TAG标签 [ 按Enter回车自动添加 ]
                    </label>
                    <div class="layui-input-block">
                       
						 <input id="tags" type="text" class="tags" name="tags" value="{fun trim($data['tags'],',')}"  autocomplete="off" class="layui-input"  />
                    </div>
                </div>
				{if($admin['isadmin']==1 || ($admin['isadmin']!=1 && $admin['ischeck']==0))}
				<div class="layui-form-item" pane>
                    <label for="isshow" class="layui-form-label">
                        <span class="x-red"></span>是否审核
                    </label>
                    <div class="layui-input-block">
                        <input type="radio" name="isshow" value="0" title="未审" {if($data['isshow']==0)}checked{/if}>
						<input type="radio" name="isshow" value="1" title="已审" {if($data['isshow']==1)}checked{/if}>
						<input type="radio" name="isshow" value="2" title="退回" {if($data['isshow']==2)}checked{/if}>
                    </div>
					 
					
                </div>
				{/if}
			
				</div>
				
				
			  </div>
			</div>
						
               
                
                <div class="layui-form-item" id="jizhitj"  style="text-align:center;">
                    
                     <button  class="layui-btn" lay-filter="save" lay-submit="">
                        保存
                    </button>
                </div>
            </form>
        </div>
		<br/>
		<br/>
		<br/>
		<br/>
		<br/>
		<br/>
		<br/>
		<br/>
		<br/>
      
        <script>
		{include="fields"}
			$(function() {
			  $('#tags').tagsInput({
					width:'auto',
					defaultText:'添加一个标签',
			  });	
			})
            layui.use(['laydate','form','layer','upload'], function(){
                $ = layui.jquery;
              var form = layui.form
              ,layer = layui.layer;
			  laydate = layui.laydate;
			  
			  var upload = layui.upload;
			 
			     //监听提交
              form.on('submit(save)', function(data){
                
				$.post("{fun U('Extmolds/editmolds',array('molds'=>$molds['biaoshi']))}",data.field,function(r){
					var r = JSON.parse(r);
					if(r.code==0){
					
						layer.confirm(r.msg, {
						  btn: ['返回列表','取消'] //按钮
						}, function(){
							// 获得frame索引
							{if($webconf['admintpl']=='tpl')}
							window.location.href="{fun U('Extmolds/index',['molds'=>$molds['biaoshi']])}";
							{else}
							parent.location.reload();
							{/if}
						  
						}, function(){
						  
						});
					
						
					}else{
						layer.alert(r.msg, {icon: 5});
					}
				});
				
               
                return false;
              });
            get_fields({$tid},{$data['id']});
			form.on('select(tid)', function(data){
			 
			  get_fields(data.value,{$data['id']});
			  
			  
			});
			  
			
		
			
           
              
              
            });
        </script>
      
    </body>

</html>